package com.weijian.dal.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 订单表
 */
@Data
@Schema(description = "订单表")
@TableName(value = "order_table", autoResultMap = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Order extends BaseDO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 订单id
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "订单id")
    private Long id;

    @Schema(description = "订单编号")
    private String number;

    @Schema(description = "总金额，单位为分")
    private Integer totalFee;

    @Schema(description = "支付类型，1、支付宝，2、微信，3、扣减余额")
    private Integer paymentType;

    @Schema(description = "用户id")
    private Long userId;

    @Schema(description = "订单状态，0、已下单，1、已支付，2、已配送 3、已取消，4、已完成")
    private Integer status;

    @Schema(description = "地址id")
    private Long addressId;

    @TableField("pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "支付时间")
    private LocalDateTime payTime;

    @TableField("end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "交易完成时间")
    private LocalDateTime endTime;

    @TableField("close_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "交易关闭时间")
    private LocalDateTime closeTime;

    @Schema(description = "备注")
    private String remark;

}
